#include <stdio.h>

#define DEBUG

int arry[6];
int box = 0;
int u[4] = {0, 5, 3, 1};//u[i]表示一个箱子中放i个3*3箱子时，可以容纳2*2箱子的个数

int main(void)
{
#ifdef DEBUG
	freopen("bin/2.5.in", "r", stdin);
#endif

	while (1)
	{
		scanf("%d %d %d %d %d %d", &arry[0], &arry[1], &arry[2],
				&arry[3], &arry[4], &arry[5]);
		if ((arry[0] | arry[1] | arry[2] | arry[3] | arry[4] | arry[5]) == 0)
		{
			break;
		}
		printf("%d %d %d %d %d %d\n", 
				arry[0], arry[1], arry[2], 
				arry[3], arry[4], arry[5]);

		box = (arry[5] + arry[4] + arry[3]);
		box += (arry[2] + 3) / 4;
		printf("%d\n", box);

		int x1 = arry[4] * 11;
		int x2 = arry[3] * 5;
		x2 += u[arry[2] % 4];
		x1 += 36 - (arry[2] % 4) * 9 - u[arry[2] % 4] * 4;

		if (arry[1] >= x2)
		{
			box += (arry[1] - x2 + 8) / 9;
			x1 += (36 - ((arry[1] - x2) % 9) * 4);
		}
		if (arry[0] >= x1)
			box += (arry[0] - x1 + 35) / 36;

		printf("%d\n", box);
	}
	return 0;
}
